//
//  traderates_search_response.m
//  yuimall_Iphone
//
//  Created by yuike6 yuike6 on 12-4-14.
//  Copyright (c) 2012年 yuike. All rights reserved.
//

#import "traderates_search_response.h"
#import "header.h"

@implementation traderates_search_response
@synthesize total_results;
@synthesize trade_rates;


-(void) dealloc
{
   
    YRelease(trade_rates);
    [super dealloc];
}

-(void) privateInit
{
    self.total_results = [[self.xmlTree valueAtPath:@"traderates_search_response/total_results"] intValue];
        
    
    NSMutableArray * tmp_trade = [[NSMutableArray alloc] init];
    
    for (XMLParsedTree * subTree in [self.xmlTree childrenTreeAtPath:@"traderates_search_response/trade_rates" nodeName:@"trade_rate"]) {
        trade_rate * trade = [[trade_rate alloc] initWithXmlTree:subTree];
        [tmp_trade addObject:trade];
        YRelease(trade);
    }
        
    self.trade_rates = tmp_trade;
    YRelease(tmp_trade);
}

-(id) initWithXmlTree:(XMLParsedTree *)tree
{
    self = [super initWithXmlTree:tree];
    if (self) {
        [self privateInit];
    }
    
    return self;
}


-(id) initWithXmlString:(NSString *)xmlString
{
    self = [super initWithXmlString:xmlString];
    if (self) {
        [self privateInit];
    }
    return self;
}

-(id) initWithXmlData:(NSData *)xmlData
{
    self = [super initWithXmlData:xmlData];
    if (self) {
        [self privateInit];
    }
    return self;
}

@end
